package com.git.code.service.user.controllor;


import com.git.code.service.common.exception.AdException;
import com.git.code.service.user.entity.Member;
import com.git.code.service.user.service.MemberService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

//在浏览器中如果向其他域名（端口不一样也算其他域名）的url发送请求，浏览器自身的安全策略是不允许的
//我们需要设置CORS（跨域访问），来解决跨域问题
@Controller
@CrossOrigin //在Controller上利用CrossOrigin解决跨域访问问题
public class MemberController {
    @Resource
    private MemberService memberService;

    @GetMapping("/check")
    @ResponseBody
    public Member checkMobile(String mobile) throws AdException {
        Member member = memberService.checkByMobile(mobile);
        return  member;
    }
}
